package com.itboye.ihomebank.adapter;

import android.content.Context;

import com.itboye.ihomebank.R;
import com.itboye.ihomebank.bean.GuanLiPassBean;
import com.itboye.ihomebank.support.commonadapter.MutiplyCommonAdapter;
import com.itboye.ihomebank.support.commonadapter.ViewHolder;
import com.itboye.ihomebank.util.TimesUtils;

import java.util.List;

/**
 * 密码发送记录-白马锁
 */
public class AdminPassAdapter extends MutiplyCommonAdapter<GuanLiPassBean.Date> {

    public AdminPassAdapter(Context context, List<GuanLiPassBean.Date> datas, int... layoutId) {
        super(context, datas, layoutId);
    }

    @Override
    public int getItemViewType(int position) {
        return 0;
    }

    @Override
    public void getItemPosition(int position) {

    }

    @Override
    public void convert(ViewHolder holder, GuanLiPassBean.Date t, int type, int position) {
        if (!t.getKeyboard_pwd().equals("")){
            holder.setText(R.id.pass_id, t.getKeyboard_pwd());
        }else{
            holder.setText(R.id.pass_id,"未设置");
        }

     //  holder.setText(R.id.pass_start, TimesUtils.timeStamp2Date(Long.parseLong(t.getSend_time())));
        if (t.getType().equals("1")){
           // holder.setText(R.id.pass_time, "单次密码:"+TimesUtils.timeStamp2Date(Long.parseLong(t.getStart()))+"  至  "+TimesUtils.timeStamp2Date(Long.parseLong(t.getEnd())));
        }else if (t.getType().equals("2")){
            holder.setText(R.id.pass_time, "永久密码");
        }else if (t.getType().equals("3")){
            holder.setText(R.id.pass_time, TimesUtils.timeStamp2Date(Long.parseLong(t.getStart()))+"  至  "+TimesUtils.timeStamp2Date(Long.parseLong(t.getEnd())));
        }

    }
}
